<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>分店管理-访客</title>
	<link rel="stylesheet" href="/js/plugin/layui-v2.3.0/layui/css/layui.css">
	<link rel="stylesheet" href="/css/reset.css">
	<link rel="stylesheet" href="/css/index.css">
	<link rel="stylesheet" href="/css/project_set.css">
	<script src="/js/jquery-2.1.1.min.js"></script>
	<script src="/js/plugin/layui/layui.js"></script>
</head>
<style>
::-webkit-scrollbar-thumb {
  background:#a2a2a2; 
  border-radius: 10px;
  height:50%;
}
::-webkit-scrollbar{width:6px;}
	body{
		overflow-y: scroll;
	} 
.date-input{
	padding-left:30px;
    background: url(/images/icon/rili_icon.png) no-repeat 10px center !important;
}
</style>
<body>
	<div class="kb-content my-locations-list">	
		<section class="kb-content-container clearfix">
				<header class="nav-section-header clearfix">
					<div class="nav-section-header-title  f-left"><span>访问列表</span></div>	
				</header>
				<div class="nav-section-content-container">
					<div class="layui-tab layui-tab-brief my-tab" lay-filter="docNavTabBrief">
						  <ul class="layui-tab-title" style=" margin-bottom: 0px;">
						    <li class="layui-this">全部</li>
						    <li value="1">邀请访问</li>
						    <li value="2">申请访问</li>
						  </ul>
						  <div class="layui-tab-content " id="teamLogo" >
						  		<div style='width: 100%; height: 100%; position: relative;'>
									<div class="mag-top-20">
										<div class="layui-input-inline" style="width:190px">
										     <input autocomplete="off" class="layui-input date-input" id="bookDate" name="bookDate" type="text">
										</div>
										<div class="time-filter">
											<button style="cursor:pointer " class="" value="1">昨天</button><button style="cursor:pointer " class="active" value="2">今天</button><button style="cursor:pointer " class="" value="3">明天</button>
										</div>
									</div>
									<div style="margin-top:10px;">
										<span class="layui-btn layui-btn-radius layui-btn-danger mag-bot-20 clear-criteria show" style="width: 150px;"><i class="layui-icon">ဆ</i> 删除全部工位</span>
									</div>
						  		</div>
						  		
						  </div>
					</div>      
				</div>
		</section>
	</div>
	<input type="hidden" id="projectId" name="projectId" th:value="${projectId}" />
</body>
<script>
var projectId = $("#projectId").val();
var table;
var startdate = null;
var enddate = null;
$(function(){
	layui.use(['element','layer','form','laydate'], function(){
		var form = layui.form,laydate = layui.laydate;
		//初始化选择日期
		laydate.render({
		  elem: '#bookDate',
		  value:getnow().year+"-"+getnow().month+"-"+getnow().date
		  ,done: function(value, date){
			  //listDataFile(value);
			  var now=getnow();
			  var shi=now.year+"-"+p(now.month)+"-"+p(now.date);
			  var newTime=setDate(now.year,now.month,now.date)
			  var shi1=newTime.year+"-"+p(newTime.month)+"-"+p(newTime.date-1);
			  var newTime1=setDate(now.year,now.month,now.date+1)
			  var shi2=newTime1.year+"-"+p(newTime1.month)+"-"+p(newTime1.date);
			  if(value==shi){
				  $(".time-filter button:eq(1)").addClass("active").siblings("button").removeClass("active");
			  }else if(value==shi1){
				  $(".time-filter button:eq(0)").addClass("active").siblings("button").removeClass("active");
			  }else if(value==shi2){
				  $(".time-filter button:eq(2)").addClass("active").siblings("button").removeClass("active");
			  }else{
				  $(".time-filter button").removeClass("active");
			  }
		  }
		});
	})
	 //方法点击日期
	  $(".time-filter button").on("click",function(){
			$(this).addClass("active").siblings("button").removeClass("active");
			var type = $(this).attr("value");
			var now=getnow();
			var shi=now.year+"-"+now.month+"-"+now.date;
			if(type==1){
				var newTime=setDate(now.year,now.month,now.date-1),
			    shi=newTime.year+"-"+newTime.month+"-"+newTime.date;
				//listDataFile(shi);
				$("#bookDate").val(shi);
			}else if(type==2){
				//listDataFile(shi);
				$("#bookDate").val(shi);
			}else if(type==3){
				var newTime=setDate(now.year,now.month,now.date+1),
			    shi=newTime.year+"-"+newTime.month+"-"+newTime.date;
				//listDataFile(shi);
				$("#bookDate").val(shi);
			}
	  })
})

function getnow(){
	var myDate = new Date();
	year=myDate.getFullYear(),//获取当前年
	month=myDate.getMonth()+1,//获取当前月
	date=myDate.getDate(),//获取当前日
	hours = myDate.getHours(), //截取小时 
	minutes = myDate.getMinutes(), //截取分钟
	allMinutes=hours*60+minutes;//过了多少分钟；
	return {
			year:year,
			month: month,
			date: date,
			hours:hours,
			allMinutes:allMinutes
	};
}
function setDate(year,month,day){
	var future=new Date(year,month-1,day),
	year=future.getFullYear(),//获取年
	month=future.getMonth()+1,//获取月
	date=future.getDate();//获取日
	return {
		year:year,
		month: month,
		date: date
	}
}
function tableBtnOpt(){
	var $mylist = $("#LAY_table_team").next('.layui-table-view').find('.layui-table-body table.layui-table');
	/*  点击tr元素,跳转详情基于table*/
	  $mylist.on("click",'tr',function(){
			var targetI=$(this);
			var id=$(targetI).children('td').find("span[data-id]").attr("data-id");
			tiaozhuan(id);
			return false;
	  }); 
}

function tipHover(target,txt){
		var index=layer.tips(txt,target, {
			  tips: [1, '#000'],
			  area: ['auto', 'auto'],
			  time: 0,
			  tipsMore: true
		});
		return index;
}
function closeAll(){
	layer.closeAll();
}
function closetip(){
	layer.close(layer.index);
}

</script>
</html>